﻿// code01060000.cpp : 书店程序
// 合计Sales_items对象

#include <iostream>
#include "Sales_item.h"
using namespace std;

int main()
{
	//total 记录总量 trans 记录当前量
	Sales_item total,trans;
	cout << "输入IBSN号，数量，单价" << endl;
	if (cin>>total)
	{
		
		while (cin>>trans)
		{
			if (trans.isbn()==total.isbn())
			{
				total += trans;
			}
			else
			{
				cout << total<<endl;
				total=trans;//总计重置为当前量

			}
		}
		cout<<"同项合计" << total << endl;
		cout << trans << endl;
	}
	else
	{
		cerr << "无数据输入，程序退出" << endl;
		return -1;//无数据输入，程序退出，返回-1
	}
	return 0;//程序成功，返回0
}

